
$(document).ready(function() {
	initTable();
	
	$('#search').on('click',function(){
		initTable();
	});
});

var table = new Table();
var initTable =function(){
	//筛选条件
	var orderNo = $('#orderNo').val();
	var sql ='?orderState=0';
	if(orderNo!=null&& orderNo!=''){
		sql += '&orderNo='+orderNo;
	}
	//表格加载的字段
    var cloumns = [
		    {'data': 'id','render': function (data) { return '<input type="checkbox" data-id="' + data + '" name="">';}},
		    {'data': 'order_no'},
		    {'data': 'picture','render': function (data) {return '<img style="max-width: 40px; max-height: 40px;"  src= "'+basePath+'/'+data+'" />';}},
		    {'data': 'nick_name'},
		    {'data': 'amount_money'},
		    {'data': 'receive_address'},
		    {'data': 'receive_address_detail'},
		    {'data': 'update_name'},
		    {'data': 'update_date'},
		    {'data': 'id','render':function(data,type,full){
		    	var url =basePath+"/order/toEditOrder?id="+data;
		    	var title = '详情';
		    	var btn='<a title="详情" href="javascript:;" onclick="toEdit(\''+title+'\',\''+url+'\',\''+type+'\')" class="btn btn-primary  radius size-MINI" style="margin-right:10px;" >'+title+'</a>';   
		    	return table.delBtn(data)+btn;
		    	}}
		  ];
	//设置URL和加载的字段
    table.setting(basePath+"/order/getOrderList"+sql,basePath+"/order/delOrder",cloumns);
	//调用表格分页
    table.tablePage();
}


